package com.acoffee.springcloud.provider.service.Impl;

import com.acoffee.springcloud.common.entity.User;
import com.acoffee.springcloud.provider.mapper.UserMapper;
import com.acoffee.springcloud.provider.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author acoffee
 * @create 2022-01-19 17:23
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;
    @Override
    public User findById(int id) {
        User user = userMapper.findById(id);
        return user;
    }

    @Override
    public List<User> findAll() {
        List<User> users = userMapper.findAll();
        return users;
    }

    @Override
    public boolean addUser(User user) {
        boolean flag = userMapper.addUser(user);
        return flag;
    }

    @Override
    public boolean updateUser(User user) {
        boolean flag = userMapper.updateUser(user);
        return flag;
    }

    @Override
    public boolean deleteUser(int id) {
        boolean flag = userMapper.deleteUser(id);
        return flag;
    }
}
